﻿using Avalonia.Collections;
using Avalonia.Data.Converters;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 畜牧业审核程序国产.Models.RagModel.SenderConvert
{
    internal class StringJoinConverter : IValueConverter
    {
        private readonly string _separator;//分隔符
        public StringJoinConverter(string separator = "\n")
        {
            _separator = separator;
        }
        public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
        {
            if (value is AvaloniaList<string> list)
            {
                return string.Join(_separator, list);
            }
            return string.Empty;
        }

        public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
